<template>
	<view class="content">
		<view class="logo-box">
			<view class="logo"></view>
		</view>
		
		<view class="title"></view>
		
		<view class="shuruwenti"></view>
		<view class="shurukuang">
			<textarea value="" placeholder="" class="textarea" v-model.trim="model.answer"/>
		</view>
		
		<view class="tijiao-btn" @click="submit">
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				model:{
					answer:'',
					state:0,
					zan:0,
					time:0
				}
			};
		},
		methods:{
			submit(){
				if (this.model.answer == '') {
					uni.showToast({
						title:'请输入您的问题',
						mask:true
					})
					return false
				} else{
					this.model.time = new Date().getTime()
					uni.showLoading({
						title:'正在提交···',
						mask:true
					})
					
					uniCloud.callFunction({
						name:'supportAddQuestion',
						data:this.model
					}).then((res)=>{
						uni.hideLoading()
						console.log(res)
						if (res.result.id) {
							uni.showModal({
								content:res.result.msg,
								showCancel:false,
								success: (res) => {
									if (res.confirm) {
										uni.navigateTo({
										url:'../index/index'
									})
									}
								}
							})
						} else{
							uni.showModal({
								content:'网络故障，请重试！',
								showCancel:false,
							})
						}
						
					}).catch((res)=>{
						uni.hideLoading()
						console.log(res)
					})
					
				}
				
				
				
			}
		}
	}
</script>

<style lang="scss">
.shurukuang{
	width: 546rpx;
	height: 247rpx;
	border-radius: 20rpx;
	border: 1px solid #d30006;
	background: #fff;
	box-shadow: 0 6rpx 2rpx #620f14;
	margin-top: 35rpx;
	margin-bottom: 24rpx;
	display: flex;
	flex-direction: row;
	justify-content: center;
	align-items: center;
}
.tijiao-btn{
	width: 213rpx;
	height: 62rpx;
	margin-top: 30rpx;
	background: url(https://7463-tcb-bzd0jghy0g4xhlb863579-8cd72f-1304347316.tcb.qcloud.la/support/submit.png) no-repeat center center;
	background-size: 100% 100%;
}
.textarea{
	width: 94%;
	height: 90%;
	// border: 1px solid #007AFF;
	font-size: 26rpx;
	color: #303030;
	line-height: 44rpx;
}
</style>
